<?php

/**
 * Documentation action.
 *
 * PHP version 5
 *
 * @category Action
 * @package  Laconica
 * @author   Evan Prodromou <evan@controlyourself.ca>
 * @author   Robin Millette <millette@controlyourself.ca>
 * @license  http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
 * @link     http://laconi.ca/
 *
 * Laconica - a distributed open-source microblogging tool
 * Copyright (C) 2008, Controlez-Vous, Inc.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

if (!defined('LACONICA')) {
    exit(1);
}

/**
 * Documentation class.
 *
 * @category Action
 * @package  Laconica
 * @author   Evan Prodromou <evan@controlyourself.ca>
 * @author   Robin Millette <millette@controlyourself.ca>
 * @license  http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
 * @link     http://laconi.ca/
 */
class WelcomeAction extends FreeAction
{

    /**
     * Class handler.
     * 
     * @param array $args array of arguments
     *
     * @return nothing
     */
    function handle($args)
    {
        if (!common_is_real_login()) {
                    $this->showPage();
        }
        else
        {
            $user = common_current_user();
            $nickname=$user->nickname;
            $url = common_local_url('all',
                                    array('nickname' =>
                                          $nickname));
            common_redirect($url);
        }
    }

      function showCore()
    {
        $this->elementStart('div', array('id' => 'core2'));
            $this->raw('<div id="loginform"  align="left">');
        $this->elementStart('form', array('method' => 'post',
                                           'id' => 'form_login',
                                           'action' => common_local_url('loginwelcome')));
$this->raw('
<div id="showform"><label for="nickname">Nickname </label><input type="text" id="nickname" name="nickname"/>
&nbsp;&nbsp;<label for="password">Mật khẩu</label>
<input type="password" id="password" class="password" name="password"/>
&nbsp;&nbsp;');
 $this->submit('submit', 'Đăng nhập');
        $this->hidden('token', common_session_token());

$this->raw('
</div>');
                $this->elementEnd('form');
$this->raw('</div>');    
$this->raw('
<div id="contentwelcome" align="center" >
<div id="roundcorner">
<div id="flashintro" >
</div>
<div id="textintro" align="justify">Tôi 24h, là dịch vụ micro-blog 140 ký tự. Tham gia ngay để chia sẻ những thông tin mới từ bạn với bạn bè, gia đình và đồng nghiệp !
</div>
<div id="registerbutton" ><a href="http://toi24h.com/main/register" title="Đăng ký và tham gia vào Toi24h"><img src="http://toi24h.com/images/register.jpg" border="0"/></a></div>
</div>
</div>');
        $this->elementEnd('div');
    }
    // overrrided to add entry-title class
    function showPageTitle() {

    }
    
    // overrided to add hentry, and content-inner classes
    function showContentBlock()
     {

     }

    /**
     * Display content.
     * 
     * @return nothing
     */
    function showContent()
    {
        $this->raw("Hello");
    }

    /**
     * Page title.
     * 
     * @return page title
     */
    function title()
    {
        return "Chào mừng bạn đến với";
  
    }

    function isReadOnly()
    {
        return true;
    }
}
